package com.yuexun.dhdoctor.module.meetingNew.ui;

import android.widget.ListView;

import com.yuexun.dhdoctor.R;
import com.yuexun.dhdoctor.base.BaseEntity;
import com.yuexun.dhdoctor.base.BaseKJActivity;
import com.yuexun.dhdoctor.config.AppConfig;
import com.yuexun.dhdoctor.module.meetingNew.adapter.MeetingNewSignAdapter;
import com.yuexun.dhdoctor.module.meetingNew.bean.MeetingNewSignBean;
import com.yuexun.dhdoctor.module.meetingNew.model.impl.MeetingNewModel;
import com.yuexun.dhdoctor.module.meetingNew.presenter.impl.MeetingNewSignPresenter;
import com.yuexun.dhdoctor.module.meetingNew.ui.view.IMeetingNewSignView;

import org.kymjs.kjframe.ui.ViewInject;
import org.kymjs.kjframe.utils.PreferenceHelper;

import java.util.HashMap;
import java.util.Map;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by Administrator on 2017/4/10 0010.
 */

public class Act_MeetingNew_Sign extends BaseKJActivity implements IMeetingNewSignView {

    @Bind(R.id.signList)
    ListView signList;

    private String meetingId;
    MeetingNewSignPresenter presenter;
    MeetingNewSignAdapter signAdapter;

    @Override
    public void setRootView() {
        super.setRootView();
        setContentView(R.layout.act_meetingnew_sign);
        ButterKnife.bind(this);
    }

    @Override
    public void initData() {
        super.initData();

        meetingId = getIntent().getExtras().getString("meetingId");
        presenter = new MeetingNewSignPresenter(new MeetingNewModel(), this);

        Map<String, String> params = new HashMap<>();
        params.put("sessionUuid", PreferenceHelper.readString(aty, AppConfig.USER_INFO, AppConfig.SESSION_ID));
        params.put("meetingId", meetingId);
        presenter.getMeetingSign(params);
    }

    @Override
    public void showMeetingSignList(BaseEntity<MeetingNewSignBean> list) {
        if (list.getStatus().equals("200")) {
            signAdapter = new MeetingNewSignAdapter(signList, list.getDatas(), R.layout.item_meeting_sign);
            signList.setAdapter(signAdapter);
        } else {
            ViewInject.toast("获取签到记录失败");
        }
    }

    @OnClick(R.id.back)
    public void onClick() {
        finish();
    }
}
